<?php

/*
 * CopyRight  : (C)2012-2099 HaoTeam Inc.
 * Document   : route.php
 * Created on : 2021-2-4 15:12:41
 * Author     : Tiger <1192851302@qq.com>
 * Description: This is NOT a freeware, use is subject to license terms.
 *              这即使是一个免费软件,使用时也请遵守许可证条款,得到当时人书面许可.
 *              未经书面许可,不得翻版,翻版必究;版权归属 HaoTeam Inc;
 */

use think\facade\Route;

Route::any('/', function () {
    return 'hello,ThinkPHP6!';
});
Route::any('sms/code', 'Auth/sms_code')->name('AuthSmsCode'); //获取验证码
Route::post('register', 'Auth/register')->name('register'); //用户注册
Route::post('login', 'Auth/login')->name('AuthLogin'); //登录
Route::post('third/login', 'Auth/third_login')->name('AuthThirdLogin'); //登录
Route::post('verify/login', 'Auth/verify_login')->name('AuthVerifyLogin'); //登录-验证码
Route::post('forgot/password', 'Auth/forgot_password')->name('AuthForgotPassword'); //重置密码
Route::post('recharge/list', 'Config/recharge')->name('recharge_list'); //充值套餐列表
Route::group('config', function () {
    Route::get('get/:id', 'Config/get')->name('ConfigGet'); //根据分组获取全部配置
});
Route::any('tiktok/callback/payment', 'tiktok.Callback/payment')->name('TiktokCallBackPay'); //微信小程序支付
Route::any('easypay/alipay/payment', 'easypay.Alipay/payment')->name('easypay_alipay_payment'); //easy支付通知，支付宝
Route::any('easypay/wechat/payment', 'easypay.Wechat/payment')->name('easypay_wechat_payment'); //easy支付通知，微信

Route::any('wechat/callback/app/:mid', 'wechat.Callback/app')->name('WeChatCallBackApp'); //微信小程序服务
Route::any('wechat/callback/payment/:mid', 'wechat.Callback/payment')->name('WeChatCallBackPay'); //微信小程序支付
Route::any('wechat/callback/refund/:mid', 'wechat.Callback/refund')->name('WeChatCallBackRefund'); //微信小程序支付
Route::post('upload/image', 'File/upload_image')->name('upload_image')->middleware(\haoteam\http\middleware\ApiAppToken::class); //上传图片
Route::post('upload/file', 'File/upload_file')->name('upload_file')->middleware(\haoteam\http\middleware\ApiAppToken::class); //上传图片
Route::get('article/detail', 'Article/detail')->name('ArticleDetail'); //内容详情
Route::post('article/list', 'Article/list')->name('ArticleList'); //内容列表
Route::post('map/geocoder', 'Map/geocoder')->name('geocoder'); //逆地址解析
//需要登录
Route::group(function () {
    Route::post('update/client', 'User/update_client')->name('AuthUpdateClient'); //更新AppCId
    Route::post('user/verify', 'User/prepare_verify')->name('user_verify'); //用户认证
    Route::post('save/verify', 'User/save_verify')->name('save_verify'); //用户认证
    Route::post('update/material', 'User/update_material')->name('user_update_material'); //更新资料
    Route::post('wechat/bind', 'User/wechat_bind')->name('AuthWechatBind'); //绑定OPENID
    Route::post('phone/bind', 'User/phone_bind')->name('AuthPhoneBind'); //绑定手机
    Route::post('third/get/phone', 'User/third_get_phone')->name('auth_third_get_phone'); //获取手机号
    Route::post('user', 'User/material')->name('use_material'); //用户资料
    Route::post('user/withdraw', 'User/withdraw')->name('use_withdraw'); //用户提现
    Route::post('user/bill', 'User/bill')->name('use_bill'); //用户账单
    Route::post('user/recharge', 'User/recharge')->name('use_recharge'); //用户充值
})->middleware(\haoteam\http\middleware\ApiAppToken::class);


Route::group('wechat', function () {
    Route::post('app/auth/:mid', 'wechat.App/auth')->name('WeChatAppAuth'); //微信小程序鉴权
    Route::get('app/logo/:mid', 'wechat.App/logo')->name('WeChatAppLogo'); //微信小程序鉴权
    Route::any('app/run/:mid/:nodes', 'wechat.App/run')->name('WeChatAppRun'); //输出应用
});
//需要登录
Route::group('wechat', function () {
    Route::post('app/user/:mid', 'wechat.App/user')->name('WeChatAppUser'); //个人中心首页
    Route::post('app/bind/phone/:mid', 'wechat.App/bind_phone')->name('WeChatAppBindPhone'); //绑定手机号
    Route::any('app/auth/run/:mid/:nodes', 'wechat.App/auth_run')->name('WeChatAppAuthRun'); //输出应用(需要登录)
    Route::post('app/code/:mid', 'wechat.App/code')->name('WeChatAppCode'); //获取小程序码
})->middleware(\haoteam\http\middleware\ApiWeChatToken::class);

Route::miss(function() {
    return 'HaoTeam Inc.';
});
